package thread;

class MyThread1 extends Thread{
    @Override
    public void run() {
        System.out.println("hello thread");
    }
}







class MyThread2 implements Runnable{
    @Override
    public void run() {
        System.out.println("hello runnable");
    }
}
public class Demo {
    public static void main(String[] args) {
        Thread t=new Thread(new MyThread2());
        t.start();
    }








    public static void main4(String[] args) {
        MyThread1 t=new MyThread1();
        t.start();
    }











    public static void main3(String[] args) {
        Thread t=new Thread(){
            @Override
            public void run() {
                System.out.println("hello thread");
            }
        };
        t.start();
    }











    public static void main2(String[] args) {
        Thread t=new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("hello thread");
            }
        });
        t.start();
    }











    public static void main1(String[] args) {
        Thread t=new Thread(()->{
            System.out.println("hello thread");
        });
        t.start();
    }
}
